
import request from '@/utils/api/request'
import qs from 'qs'

// 创建小组请求
export const addPlan = params => {
  return request({
    method: 'POST',
    url: '/plan/create',
    params
  })
}
// 获取所有计划
export const getAllPlan = () => {
  return request({
    method: 'POST',
    url: '/plan/selectAllPlans'
  })
}
// 删除计划请求
export const deletePlan = planId => {
  return request({
    method: 'POST',
    url: `/plan/deletePlan?pid=${planId}`
  })
}

// 创建待办项
export const addThings = (listId, data) => {
  return request({
    method: 'POST',
    url: `/plan/addItems?pid=${listId}`,
    data
  })
}
// 删除待办项
export const deleteThing = (id) => {
  return request({
    method: 'POST',
    url: `/plan/deleteItems?ItemID=${id}`,
  })
}
// 查看计划的待办项
export const getToDo = listId => {
  return request({
    method: 'POST',
    url: `/plan/selectToDo?pid=${listId}`
  })
}
// 更新待办项
export const updateThing = (data) => {
  return request({
    method: 'POST',
    url: `/plan/updateItems`,
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
